<!doctype html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <link rel="stylesheet" type="text/css" href="./css/aui.css" />
    <link rel="stylesheet" type="text/css" href="./css/style.css" />
    <link rel="stylesheet" type="text/css" href="./css/font-awesome.min.css" />
    <script type="text/javascript" src="./script/jquery.min.js"></script>
    <link class="theme" rel="stylesheet" type="text/css" href="./css/color/blue.css" />
    <script type="text/javascript" src="./script/doT.min.js"></script>
    <script type="text/javascript" src="./script/echo.min.js"></script>


</head>
<!-- fa fa-caret-left -->
<!-- aui-iconfont aui-icon-left -->
<body>
    <div class="head">
      <div class="head-s">
        <span>市管领导干部信息查询系统--分类查询</span>
        <div class="head-l"><i class="fa fa-caret-left" onclick="closeWin()"></i></div>
        <!-- <div class="head-r"><i class="fa fa-user"></i></div> -->
      </div>
    </div>

    <!-- <header class="aui-bar aui-bar-nav header">
      <a class="aui-pull-left">
          <span class="fa fa-caret-left" onclick="closeWin()"></span>
      </a>
        <div class="aui-title"><span>市管领导干部信息查询系统--分类查询</span></div>
    </header> -->
    <div class="header-d"></div>

    <div style="padding:20px 20px 0;" id='count'>符合条件记录数(0)条</div>
    <div id="list">
    </div>
    <script type='text/template' id='template'>
        <div class="classify-img">
            <ul>
                {{~it :value:index}} {{? value==0}}
                <h2 class="classify-no"></h2> {{??}}
                <li onclick="click_in({{=value.ID}})">
                  <img src="file:///storage/emulated/0/ader/java/{{=value.ID}}.jv"  data-echo="file:///storage/emulated/0/ader/java/{{=value.ID}}.jv">
                    <dl>
                        <dt>{{=value.I01}}</dt>
                        <dd>{{=value.I16}}</dd>
                    </dl>
                </li>
                {{?}} {{~}}
            </ul>
        </div>
    </script>
</body>
<script type="text/javascript" src="./script/api.js"></script>

</html>
<script>
function echoInit() {
        echo.init({
                offset : 20000,
                throttle : 0 //设置图片延迟加载的时间
        });
}
    function closeWin() {
        // api.execScript({
        //     name: 'index',
        //     script: 'reloadIndex();'
        // });
        api.closeFrame();

    }

    function click_in(index) {
      api.showProgress({
          title: '努力加载中...',
          modal: false
      });
      api.openWin({
          name: 'jianlihead',
          url: './jianlihead.html',
          // scaleEnabled: true,
          reload:true,
          pageParam: {
              id: index
          },
            // delay: 500
      });
    }

    apiready = function() {

        var color = $api.getStorage('color');
        $(".theme").attr("href", color);
        var temp = api.pageParam.title;
        $('#title').text(temp);
        var id = api.pageParam.id;
        var sql = 'SELECT * FROM( SELECT * FROM base_dptldr WHERE  Dpt_ID =' + id + ') AS a inner  JOIN base_info on a.Ldr_ID = base_info.ID ORDER BY iSort';
        var db = api.require('CPDB');

        db.selectSql({
            name: 'data',
            sql: sql
        }, function(ret, err) {
            if (ret.status) {
                // alert(JSON.stringify(ret.data));
                title = ret.data;
                if (ret.data == '') {
                    title = '0';
                }
                var count = '符合条件记录数('+ret.data.length+')条'
                $('#count').html(count);
                var dotFn = doT.template(template.innerHTML);
                var html = dotFn(title);
                var list = $api.byId('list');
                $api.html(list, html);
                setTimeout(function() {
                  echoInit();
                }, 1);
                  api.hideProgress();
            } else {
                alert(JSON.stringify(err));
            }
        });

    }
</script>
